import axios from '@/libs/request/axios'
// 获取一级部门
export const initDepartment = (params) => {
    return axios.request({
        url: '/admin/department/getByParentId/0',
        params: params,
        method: 'get'
    })
}
// 加载部门子级数据
export const loadDepartment = (id, params) => {
    return axios.request({
        url: `/admin/department/getByParentId/${id}`,
        params: params,
        method: 'get'
    })
}
// 添加部门
export const addDepartment = (params) => {
    return axios.request({
        url: '/admin/department/add',
        data: params,
        method: 'post'
    })
}
// 编辑部门
export const editDepartment = (params) => {
    return axios.request({
        url: '/admin/department/edit',
        data: params,
        method: 'post'
    })
}
// 删除部门
export const deleteDepartment = (ids, params) => {
    return axios.request({
        url: `/admin/department/delByIds/${ids}`,
        params: params,
        method: 'delete'
    })
}
// 搜索部门
export const searchDepartment = (params) => {
    return axios.request({
        url: '/admin/department/search',
        params: params,
        method: 'get'
    })
}
